
import 'package:flutter/material.dart';

import '../../../utils/Settings.dart';


class SelectListPage extends StatefulWidget{
  const SelectListPage({super.key, required this.dictOptions, required this.checkVals});
  final List dictOptions;
  final List checkVals;
  @override
  State<SelectListPage> createState() =>SelectListState();

}

class SelectListState extends State<SelectListPage> with AutomaticKeepAliveClientMixin{

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  bool get wantKeepAlive => true;

  ///开始自定义业务

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return ListView.builder(
      itemBuilder: (BuildContext context, int index) {
        return CheckboxListTile(
          activeColor: Settings.primaryColor,
          side: const BorderSide(color: Color.fromRGBO(194, 194, 194, 1)),
          title: Text(widget.dictOptions[index]["itemText"]),
          value: widget.checkVals[index],
          onChanged: (v){
            widget.checkVals[index] = v!;
            setState(() {});
          },
        );
      },
      itemCount: widget.dictOptions.length,
    );
  }

}